/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package it.unibo.as.client;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;

/**
 *
 * @author Johnny
 */
public class MenuGameBar extends MenuBar{

    /*
    private final MenuItem mntmGame;
    private final MenuBar menuBar_1;
    private final MenuBar menuBar_2;
    private final MenuItem mntmNew;
    private final MenuItem mntmMultiplayer;
    private final MenuItem mntmSinglePlayer;
    private final MenuItem mntmAccount;
    private final MenuItem mntmHelp;
    */
    private final MenuItem mntmSignout;




    public MenuGameBar() {
        /* crea widget menubar verticale */
        super(false);

        final MainPanel mainview = (MainPanel) getParent();

MenuBar menuBar_1 = new MenuBar(true);

		MenuItem mntmGame = new MenuItem("Game", false, menuBar_1);
		MenuBar menuBar_2 = new MenuBar(true);

		MenuItem mntmNew = new MenuItem("New Table", false, menuBar_2);

		MenuItem mntmMultiplayer = new MenuItem("Multi Player", false, new Command() {
			public void execute() {
			}
		});
		menuBar_2.addItem(mntmMultiplayer);

		MenuItem mntmSinglePlayer = new MenuItem("Single Player", false, (Command) null);
		menuBar_2.addItem(mntmSinglePlayer);
		menuBar_1.addItem(mntmNew);

		MenuItem mntmOpenTable = new MenuItem("Open Table", false, (Command) null);
		menuBar_1.addItem(mntmOpenTable);
		addItem(mntmGame);
		MenuBar menuBar_3 = new MenuBar(true);

		MenuItem mntmAccount_1 = new MenuItem("Account", false, menuBar_3);

		mntmSignout = new MenuItem("SignOut", false, new Command() {
            @Override
                    public void execute() {
                        mainview.signout();
                    }
                });
		menuBar_3.addItem(mntmSignout);

		MenuItem mntmProfileInfo = new MenuItem("Profile Info", false, (Command) null);
		menuBar_3.addItem(mntmProfileInfo);
		addItem(mntmAccount_1);

		MenuItem mntmHelp = new MenuItem("Help", false, (Command) null);
		addItem(mntmHelp);

    }


    public void isLogged(Boolean logged, String user){
        mntmSignout.setEnabled(logged);
        if(logged){
            mntmSignout.setText("Signout " + user);
        }
    }

}

